package wechat.service.common;

import wechat.handler.resources.AppFilter;
import wechat.handler.resources.InstanceResource;

public class SwitchResources {
	
	public static String getUrlResources(String appid,String state, String userAgent) {
		String url = "";

		if (userAgent.contains(PayUserAgent.Wechat.getType())) {
			url = getWechatUrl(appid, state);
		}

		return url;
	}

	private static String getWechatUrl(String appid,String state) {
		InstanceResource instanceResource = AppFilter.chooseApp(appid);
		String authUrl = instanceResource.getAuth().replace("APPID", appid).replace("STATE", state);
		return authUrl;
	}
}
